import axios from "../config.js";

/**
 * 分页查询用户信息
 * @returns {Promise<unknown>}
 */
export const findPage = data => {
    return axios({
        url: "/demo/user/findByPage",
        method: "get",
        params: data
    });
};

/**
 * 查询所有用户信息
 * @returns {Promise<unknown>}
 */
export const findAll = data => {
    return axios({
        url: "/demo/user/findAll",
        method: "post",
        params: data
    });
};

/**
 * 通过id查找单个数据信息
 * @returns {Promise<unknown>}
 */
export const findOne = (data) => {
    return axios({
        url: "/demo/user/findOne/" ,
        method: "post",
        data
    });
};



/**
 * 通过上传表格进行添加用户信息
 * @param data
 * @returns {Promise<unknown>}
 */
export const saveFromExcel = data => {
    return axios({
        url: "/demo/user/saveFromExcel",
        method: "post",
        data
    });
};
/**
 * 添加用户信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const save = data => {
    return axios({
        url: "/demo/user/save/" ,
        method: "post",
        data
    });
};
/**
 * 更新用户信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const update = data => {
    return axios({
        url: "/demo/user/update/" ,
        method: "post",
        data
    });
};

/**
 * 删除用户信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const del = (data) => {
    return axios({
        url: "/demo/user/delete/" ,
        method: "post",
        data
    });
};

/**
 * 删除选中用户信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const delMgs = data => {
    return axios({
        url: "/demo/user/deleteMessages" ,
        method: "post",
        data
    });
};
export const updateUser = data => {
    return axios({
        url: "/demo/user/updateUser",
        method: "get",
        params: data
    });
};
export const updatePassword = data => {
    return axios({
        url: "/demo/user/updatePassword",
        method: "get",
        params: data
    });
};


